package com.example.kotlinstudy.bean

import kotlin.math.absoluteValue
//主构造函数，次构造函数
//构造函数的使用
// 临时变量：加下划线表示只会一次
class ClassDefinition(_name: String, _age: Int, _isNormal: Boolean) {

    var name: String = _name
        get() = field.capitalize()
        private set(value) { //还可以让set方法不可见
            field = value.capitalize()
        }

    var age: Int = _age
        set(value) {
            field = age.absoluteValue
        }


    var isNormal: Boolean = _isNormal

    fun x() {
        name="~~"
    }
}